<template>
	<view class="container">
		<uni-forms ref="form" :rules="{}">
			<uni-forms-item label="" name="">
				<uni-easyinput  v-model="regs.telephone" placeholder="请输入用户名" />
			</uni-forms-item>
			<uni-forms-item label="" name="">
				<uni-easyinput  v-model="regs.password" placeholder="请输入密码" />
			</uni-forms-item>
			<uni-forms-item label="" name="">
				<button type="primary" @click="reg">注册</button>
			</uni-forms-item>
		</uni-forms>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				regs:{
				telephone:"12345678912",
				password:"123456",
				}
			}
		},
		methods: {
			reg(){
				uni.request({
					url: 'http://localhost:8090/foodapp/user/register',
					method: 'POST',
					data: this.regs,
					success: res => {
						if (res.data.success) {
								uni.navigateTo({
									url:"../login/login"	
							})
							uni.showToast({
								title: '成功',
								icon: 'none'
							});
						} else {
							uni.showToast({
								title: '失败',
								icon: 'none'
							});
						}
					},
					fail: () => {
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					},
					complete: () => {}
				});
			}
		}
		// onLoad: () => {
		// 	uni.onTabBarMidButtonTap(function(e){
		// 		console.log(e)
				
		// 	})
		
		}
	
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
